.class public final Lcom/ninesky/browser/provider/downloads/q;
.super Ljava/lang/Thread;


# instance fields
.field private a:Landroid/content/Context;

.field private b:Lcom/ninesky/browser/provider/downloads/s;

.field private c:Lcom/ninesky/browser/provider/downloads/l;


# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/ninesky/browser/provider/downloads/l;Lcom/ninesky/browser/provider/downloads/s;)V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    iput-object p1, p0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    iput-object p2, p0, Lcom/ninesky/browser/provider/downloads/q;->c:Lcom/ninesky/browser/provider/downloads/l;

    iput-object p3, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    return-void
.end method

.method private a(Lcom/ninesky/browser/provider/downloads/h;Ljava/lang/String;)I
    .locals 3

    const/16 v2, 0xc1

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->c:Lcom/ninesky/browser/provider/downloads/l;

    invoke-static {v0}, Lcom/ninesky/browser/provider/downloads/g;->a(Lcom/ninesky/browser/provider/downloads/l;)Z

    move-result v0

    if-nez v0, :cond_0

    move v0, v2

    :goto_0
    return v0

    :cond_0
    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v0, v0, Lcom/ninesky/browser/provider/downloads/s;->k:I

    const/4 v1, 0x5

    if-ge v0, v1, :cond_1

    const/4 v0, 0x1

    iput-boolean v0, p1, Lcom/ninesky/browser/provider/downloads/h;->d:Z

    move v0, v2

    goto :goto_0

    :cond_1
    const-string v0, "DownloadManager"

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "reached max retries: "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " for "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v2, v2, Lcom/ninesky/browser/provider/downloads/s;->a:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    const/16 v0, 0x1ef

    goto :goto_0
.end method

.method private a(Lcom/ninesky/browser/provider/downloads/h;Lorg/apache/http/HttpResponse;)Ljava/io/InputStream;
    .locals 3

    :try_start_0
    invoke-interface {p2}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v0

    invoke-interface {v0}, Lorg/apache/http/HttpEntity;->getContent()Ljava/io/InputStream;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    return-object v0

    :catch_0
    move-exception v0

    new-instance v1, Lcom/ninesky/browser/provider/downloads/k;

    const-string v2, "IOException getting entity"

    invoke-direct {p0, p1, v2}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;Ljava/lang/String;)I

    move-result v2

    invoke-direct {v1, p0, v2, v0}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;ILjava/lang/Throwable;)V

    throw v1
.end method

.method static synthetic a(Ljava/lang/String;)Ljava/lang/String;
    .locals 1

    invoke-static {p0}, Lcom/ninesky/browser/provider/downloads/q;->b(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private a(Lcom/ninesky/browser/provider/downloads/h;Landroid/net/http/AndroidHttpClient;Lorg/apache/http/client/methods/HttpGet;)Lorg/apache/http/HttpResponse;
    .locals 3

    :try_start_0
    invoke-virtual {p2, p3}, Landroid/net/http/AndroidHttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1

    move-result-object v0

    return-object v0

    :catch_0
    move-exception v0

    new-instance v1, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v2, 0x1ef

    invoke-direct {v1, p0, v2, v0}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;ILjava/lang/Throwable;)V

    throw v1

    :catch_1
    move-exception v0

    new-instance v1, Lcom/ninesky/browser/provider/downloads/k;

    const-string v2, "IOException trying to execute request"

    invoke-direct {p0, p1, v2}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;Ljava/lang/String;)I

    move-result v2

    invoke-direct {v1, p0, v2, v0}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;ILjava/lang/Throwable;)V

    throw v1
.end method

.method private a()V
    .locals 2

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    invoke-virtual {v0}, Lcom/ninesky/browser/provider/downloads/s;->c()Z

    move-result v0

    if-nez v0, :cond_0

    new-instance v0, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v1, 0xc1

    invoke-direct {v0, p0, v1}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v0

    :cond_0
    return-void
.end method

.method private a(IZIIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 6

    const/4 v5, 0x0

    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    const-string v1, "status"

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    const-string v1, "_data"

    invoke-virtual {v0, v1, p6}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    if-eqz p7, :cond_0

    const-string v1, "uri"

    invoke-virtual {v0, v1, p7}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    :cond_0
    const-string v1, "mimetype"

    invoke-virtual {v0, v1, p8}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    const-string v1, "lastmod"

    iget-object v2, p0, Lcom/ninesky/browser/provider/downloads/q;->c:Lcom/ninesky/browser/provider/downloads/l;

    invoke-interface {v2}, Lcom/ninesky/browser/provider/downloads/l;->a()J

    move-result-wide v2

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    const-string v1, "method"

    shl-int/lit8 v2, p4, 0x1c

    add-int/2addr v2, p3

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    if-nez p2, :cond_2

    const-string v1, "numfailed"

    const/4 v2, 0x0

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    :goto_0
    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    sget-object v2, Lcom/ninesky/browser/provider/downloads/w;->a:Landroid/net/Uri;

    iget-object v3, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v3, v3, Lcom/ninesky/browser/provider/downloads/s;->a:I

    int-to-long v3, v3

    invoke-static {v2, v3, v4}, Landroid/content/ContentUris;->withAppendedId(Landroid/net/Uri;J)Landroid/net/Uri;

    move-result-object v2

    invoke-virtual {v1, v2, v0, v5, v5}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    invoke-static {p1}, Lcom/ninesky/browser/provider/downloads/w;->c(I)Z

    move-result v0

    if-eqz v0, :cond_1

    sget-object v0, Lcom/ninesky/browser/provider/downloads/e;->a:Landroid/net/Uri;

    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v1, v1, Lcom/ninesky/browser/provider/downloads/s;->a:I

    int-to-long v1, v1

    invoke-static {v0, v1, v2}, Landroid/content/ContentUris;->withAppendedId(Landroid/net/Uri;J)Landroid/net/Uri;

    move-result-object v0

    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    invoke-virtual {v1, v0}, Lcom/ninesky/browser/provider/downloads/s;->a(Landroid/net/Uri;)V

    :cond_1
    return-void

    :cond_2
    if-eqz p5, :cond_3

    const-string v1, "numfailed"

    const/4 v2, 0x1

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    goto :goto_0

    :cond_3
    const-string v1, "numfailed"

    iget-object v2, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v2, v2, Lcom/ninesky/browser/provider/downloads/s;->k:I

    add-int/lit8 v2, v2, 0x1

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    goto :goto_0
.end method

.method private static a(Lcom/ninesky/browser/provider/downloads/h;I)V
    .locals 2

    invoke-static {p0}, Lcom/ninesky/browser/provider/downloads/q;->b(Lcom/ninesky/browser/provider/downloads/h;)V

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    if-eqz v0, :cond_0

    invoke-static {p1}, Lcom/ninesky/browser/provider/downloads/w;->b(I)Z

    move-result v0

    if-eqz v0, :cond_0

    new-instance v0, Ljava/io/File;

    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    :cond_0
    return-void
.end method

.method private a(Lcom/ninesky/browser/provider/downloads/h;Lcom/ninesky/browser/provider/downloads/m;[BLjava/io/InputStream;)V
    .locals 9

    const/16 v8, 0x1ea

    const/4 v7, 0x1

    const/4 v6, 0x0

    :cond_0
    invoke-direct {p0, p1, p2, p3, p4}, Lcom/ninesky/browser/provider/downloads/q;->b(Lcom/ninesky/browser/provider/downloads/h;Lcom/ninesky/browser/provider/downloads/m;[BLjava/io/InputStream;)I

    move-result v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_4

    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    const-string v1, "current_bytes"

    iget v2, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    iget-object v1, p2, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    if-nez v1, :cond_1

    const-string v1, "total_bytes"

    iget v2, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    :cond_1
    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    iget-object v2, p1, Lcom/ninesky/browser/provider/downloads/h;->h:Landroid/net/Uri;

    invoke-virtual {v1, v2, v0, v6, v6}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    iget-object v0, p2, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    if-eqz v0, :cond_2

    iget v0, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    iget-object v1, p2, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v1

    if-eq v0, v1, :cond_2

    move v0, v7

    :goto_0
    if-eqz v0, :cond_7

    invoke-direct {p0, p2}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/m;)Z

    move-result v0

    if-eqz v0, :cond_3

    new-instance v0, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v1, 0x1e9

    invoke-direct {v0, p0, v1}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v0

    :cond_2
    const/4 v0, 0x0

    goto :goto_0

    :cond_3
    new-instance v0, Lcom/ninesky/browser/provider/downloads/k;

    const-string v1, "closed socket"

    invoke-direct {p0, p1, v1}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;Ljava/lang/String;)I

    move-result v1

    invoke-direct {v0, p0, v1}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v0

    :cond_4
    iput-boolean v7, p1, Lcom/ninesky/browser/provider/downloads/h;->i:Z

    invoke-direct {p0, p1, p3, v0}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;[BI)V

    iget v1, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    add-int/2addr v0, v1

    iput v0, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->c:Lcom/ninesky/browser/provider/downloads/l;

    invoke-interface {v0}, Lcom/ninesky/browser/provider/downloads/l;->a()J

    move-result-wide v0

    iget v2, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    iget v3, p2, Lcom/ninesky/browser/provider/downloads/m;->g:I

    sub-int/2addr v2, v3

    const/16 v3, 0x1000

    if-le v2, v3, :cond_5

    iget-wide v2, p2, Lcom/ninesky/browser/provider/downloads/m;->h:J

    sub-long v2, v0, v2

    const-wide/16 v4, 0x5dc

    cmp-long v2, v2, v4

    if-lez v2, :cond_5

    new-instance v2, Landroid/content/ContentValues;

    invoke-direct {v2}, Landroid/content/ContentValues;-><init>()V

    const-string v3, "current_bytes"

    iget v4, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    invoke-virtual {v2, v3, v4}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    iget-object v3, p0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    iget-object v4, p1, Lcom/ninesky/browser/provider/downloads/h;->h:Landroid/net/Uri;

    invoke-virtual {v3, v4, v2, v6, v6}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    iget v2, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    iput v2, p2, Lcom/ninesky/browser/provider/downloads/m;->g:I

    iput-wide v0, p2, Lcom/ninesky/browser/provider/downloads/m;->h:J

    :cond_5
    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    monitor-enter v0

    :try_start_0
    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v1, v1, Lcom/ninesky/browser/provider/downloads/s;->i:I

    if-ne v1, v7, :cond_6

    new-instance v1, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v2, 0xc1

    invoke-direct {v1, p0, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v1

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1

    :cond_6
    :try_start_1
    monitor-exit v0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v0, v0, Lcom/ninesky/browser/provider/downloads/s;->j:I

    if-ne v0, v8, :cond_0

    new-instance v0, Lcom/ninesky/browser/provider/downloads/k;

    invoke-direct {v0, p0, v8}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v0

    :cond_7
    return-void
.end method

.method private a(Lcom/ninesky/browser/provider/downloads/h;[BI)V
    .locals 6

    const/4 v5, 0x0

    const/4 v4, 0x1

    :cond_0
    :try_start_0
    iget-object v0, p1, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;

    if-nez v0, :cond_1

    new-instance v0, Ljava/io/FileOutputStream;

    iget-object v1, p1, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    const/4 v2, 0x1

    invoke-direct {v0, v1, v2}, Ljava/io/FileOutputStream;-><init>(Ljava/lang/String;Z)V

    iput-object v0, p1, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;

    :cond_1
    iget-object v0, p1, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;

    const/4 v1, 0x0

    invoke-virtual {v0, p2, v1, p3}, Ljava/io/FileOutputStream;->write([BII)V

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v0, v0, Lcom/ninesky/browser/provider/downloads/s;->g:I

    if-nez v0, :cond_2

    invoke-static {p1}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;)Z

    move-result v0

    if-nez v0, :cond_2

    invoke-static {p1}, Lcom/ninesky/browser/provider/downloads/q;->b(Lcom/ninesky/browser/provider/downloads/h;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    :cond_2
    return-void

    :catch_0
    move-exception v0

    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v2, v1, Lcom/ninesky/browser/provider/downloads/s;->g:I

    if-eq v2, v4, :cond_4

    iget v2, v1, Lcom/ninesky/browser/provider/downloads/s;->g:I

    const/4 v3, 0x3

    if-eq v2, v3, :cond_4

    iget v1, v1, Lcom/ninesky/browser/provider/downloads/s;->g:I

    const/4 v2, 0x2

    if-eq v1, v2, :cond_4

    move v1, v5

    :goto_0
    if-eqz v1, :cond_3

    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    const-wide/16 v2, 0x1000

    invoke-static {v1, v2, v3}, Lcom/ninesky/browser/provider/downloads/g;->a(Landroid/content/Context;J)Z

    move-result v1

    if-nez v1, :cond_0

    :cond_3
    new-instance v1, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v2, 0x1ec

    invoke-direct {v1, p0, v2, v0}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;ILjava/lang/Throwable;)V

    throw v1

    :cond_4
    move v1, v4

    goto :goto_0
.end method

.method private a(Lcom/ninesky/browser/provider/downloads/m;Lorg/apache/http/client/methods/HttpGet;)V
    .locals 3

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    invoke-virtual {v0}, Lcom/ninesky/browser/provider/downloads/s;->a()Ljava/util/Map;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-nez v0, :cond_2

    iget-boolean v0, p1, Lcom/ninesky/browser/provider/downloads/m;->c:Z

    if-eqz v0, :cond_1

    iget-object v0, p1, Lcom/ninesky/browser/provider/downloads/m;->b:Ljava/lang/String;

    if-eqz v0, :cond_0

    const-string v0, "If-Match"

    iget-object v1, p1, Lcom/ninesky/browser/provider/downloads/m;->b:Ljava/lang/String;

    invoke-virtual {p2, v0, v1}, Lorg/apache/http/client/methods/HttpGet;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    :cond_0
    const-string v0, "Range"

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "bytes="

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget v2, p1, Lcom/ninesky/browser/provider/downloads/m;->a:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "-"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p2, v0, v1}, Lorg/apache/http/client/methods/HttpGet;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    :cond_1
    return-void

    :cond_2
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Ljava/util/Map$Entry;

    invoke-interface {p0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    invoke-interface {p0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Ljava/lang/String;

    invoke-virtual {p2, v0, p0}, Lorg/apache/http/client/methods/HttpGet;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method private static a(Lcom/ninesky/browser/provider/downloads/h;)Z
    .locals 2

    const-string v0, "application/vnd.oma.drm.message"

    iget-object v1, p0, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method private a(Lcom/ninesky/browser/provider/downloads/m;)Z
    .locals 1

    iget v0, p1, Lcom/ninesky/browser/provider/downloads/m;->a:I

    if-lez v0, :cond_0

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget-boolean v0, v0, Lcom/ninesky/browser/provider/downloads/s;->c:Z

    if-nez v0, :cond_0

    iget-object v0, p1, Lcom/ninesky/browser/provider/downloads/m;->b:Ljava/lang/String;

    if-nez v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private b(Lcom/ninesky/browser/provider/downloads/h;Lcom/ninesky/browser/provider/downloads/m;[BLjava/io/InputStream;)I
    .locals 5

    const/4 v4, 0x0

    :try_start_0
    invoke-virtual {p4, p3}, Ljava/io/InputStream;->read([B)I
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v0

    return v0

    :catch_0
    move-exception v0

    new-instance v1, Landroid/content/ContentValues;

    invoke-direct {v1}, Landroid/content/ContentValues;-><init>()V

    const-string v2, "current_bytes"

    iget v3, p2, Lcom/ninesky/browser/provider/downloads/m;->a:I

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v2, v3}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    iget-object v2, p0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    iget-object v3, p1, Lcom/ninesky/browser/provider/downloads/h;->h:Landroid/net/Uri;

    invoke-virtual {v2, v3, v1, v4, v4}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    invoke-direct {p0, p2}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/m;)Z

    move-result v1

    if-eqz v1, :cond_0

    const-string v1, "DownloadManager"

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "download IOException for download "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v3, p0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    iget v3, v3, Lcom/ninesky/browser/provider/downloads/s;->a:I

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    const-string v1, "DownloadManager"

    const-string v2, "can\'t resume interrupted download with no ETag"

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    new-instance v1, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v2, 0x1e9

    invoke-direct {v1, p0, v2, v0}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;ILjava/lang/Throwable;)V

    throw v1

    :cond_0
    new-instance v1, Lcom/ninesky/browser/provider/downloads/k;

    const-string v2, "download IOException"

    invoke-direct {p0, p1, v2}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;Ljava/lang/String;)I

    move-result v2

    invoke-direct {v1, p0, v2, v0}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;ILjava/lang/Throwable;)V

    throw v1
.end method

.method private static b(Ljava/lang/String;)Ljava/lang/String;
    .locals 3

    :try_start_0
    invoke-virtual {p0}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v0

    sget-object v1, Ljava/util/Locale;->ENGLISH:Ljava/util/Locale;

    invoke-virtual {v0, v1}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;

    move-result-object v0

    const/16 v1, 0x3b

    invoke-virtual {v0, v1}, Ljava/lang/String;->indexOf(I)I

    move-result v1

    const/4 v2, -0x1

    if-eq v1, v2, :cond_0

    const/4 v2, 0x0

    invoke-virtual {v0, v2, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    :cond_0
    :goto_0
    return-object v0

    :catch_0
    move-exception v0

    const/4 v0, 0x0

    goto :goto_0
.end method

.method private static b(Lcom/ninesky/browser/provider/downloads/h;)V
    .locals 1

    :try_start_0
    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;

    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method


# virtual methods
.method public final run()V
    .locals 25

    const/16 v5, 0xa

    invoke-static {v5}, Landroid/os/Process;->setThreadPriority(I)V

    new-instance v15, Lcom/ninesky/browser/provider/downloads/h;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    invoke-direct {v15, v5}, Lcom/ninesky/browser/provider/downloads/h;-><init>(Lcom/ninesky/browser/provider/downloads/s;)V

    const/4 v6, 0x0

    const/4 v7, 0x0

    const/16 v16, 0x1eb

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    const/4 v8, 0x0

    iput-object v8, v5, Lcom/ninesky/browser/provider/downloads/s;->A:Ljava/lang/String;

    :try_start_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    move-object v5, v0

    const-string v8, "power"

    invoke-virtual {v5, v8}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Landroid/os/PowerManager;

    const/4 v8, 0x1

    const-string v9, "DownloadManager"

    invoke-virtual {v5, v8, v9}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_3
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_0 .. :try_end_0} :catch_1a
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_18
    .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_16

    move-result-object v17

    :try_start_1
    invoke-virtual/range {v17 .. v17}, Landroid/os/PowerManager$WakeLock;->acquire()V

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    iget-object v5, v5, Lcom/ninesky/browser/provider/downloads/s;->r:Ljava/lang/String;

    if-nez v5, :cond_0

    const-string v5, "AndroidDownloadManager"

    :cond_0
    invoke-static {v5}, Landroid/net/http/AndroidHttpClient;->newInstance(Ljava/lang/String;)Landroid/net/http/AndroidHttpClient;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_4
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_1 .. :try_end_1} :catch_1b
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_19
    .catch Ljava/lang/RuntimeException; {:try_start_1 .. :try_end_1} :catch_17

    move-result-object v18

    const/4 v5, 0x0

    move/from16 v19, v5

    :goto_0
    if-eqz v19, :cond_3

    :try_start_2
    invoke-static {v15}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;)Z

    move-result v5

    if-eqz v5, :cond_2f

    new-instance v5, Ljava/io/File;

    iget-object v6, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-direct {v5, v6}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    move-object v6, v0

    invoke-virtual {v6}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v6

    const/4 v7, 0x0

    invoke-static {v6, v5, v7}, Landroid/provider/DrmStore;->addDrmFile(Landroid/content/ContentResolver;Ljava/io/File;Ljava/lang/String;)Landroid/content/Intent;

    move-result-object v6

    invoke-virtual {v5}, Ljava/io/File;->delete()Z

    if-nez v6, :cond_2b

    const-string v5, "DownloadManager"

    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "unable to add file "

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v7, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, " to DrmProvider"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    new-instance v5, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v6, 0x1eb

    move-object v0, v5

    move-object/from16 v1, p0

    move v2, v6

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v5
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_2 .. :try_end_2} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_2 .. :try_end_2} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_2 .. :try_end_2} :catch_3

    :catch_0
    move-exception v5

    move-object/from16 v7, v17

    move-object/from16 v8, v18

    :goto_1
    :try_start_3
    iget v6, v5, Lcom/ninesky/browser/provider/downloads/k;->a:I
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_5

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    const/4 v9, 0x0

    iput-boolean v9, v5, Lcom/ninesky/browser/provider/downloads/s;->B:Z

    if-eqz v7, :cond_1

    invoke-virtual {v7}, Landroid/os/PowerManager$WakeLock;->release()V

    :cond_1
    if-eqz v8, :cond_2

    invoke-virtual {v8}, Landroid/net/http/AndroidHttpClient;->close()V

    :cond_2
    invoke-static {v15, v6}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;I)V

    iget-boolean v7, v15, Lcom/ninesky/browser/provider/downloads/h;->d:Z

    iget v8, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    iget v9, v15, Lcom/ninesky/browser/provider/downloads/h;->f:I

    iget-boolean v10, v15, Lcom/ninesky/browser/provider/downloads/h;->i:Z

    iget-object v11, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    iget-object v12, v15, Lcom/ninesky/browser/provider/downloads/h;->g:Ljava/lang/String;

    iget-object v13, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    move-object/from16 v5, p0

    invoke-direct/range {v5 .. v13}, Lcom/ninesky/browser/provider/downloads/q;->a(IZIIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    :goto_2
    return-void

    :cond_3
    :try_start_4
    new-instance v20, Lorg/apache/http/client/methods/HttpGet;

    iget-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->j:Ljava/lang/String;

    move-object/from16 v0, v20

    move-object v1, v5

    invoke-direct {v0, v1}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_4 .. :try_end_4} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_4 .. :try_end_4} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_4 .. :try_end_4} :catch_3

    :try_start_5
    new-instance v21, Lcom/ninesky/browser/provider/downloads/m;

    invoke-direct/range {v21 .. v21}, Lcom/ninesky/browser/provider/downloads/m;-><init>()V

    const/16 v5, 0x1000

    move v0, v5

    new-array v0, v0, [B

    move-object/from16 v22, v0

    iget-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    if-eqz v5, :cond_7

    iget-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-static {v5}, Lcom/ninesky/browser/provider/downloads/g;->a(Ljava/lang/String;)Z

    move-result v5

    if-nez v5, :cond_6

    new-instance v5, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v6, 0x1ec

    move-object v0, v5

    move-object/from16 v1, p0

    move v2, v6

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v5
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_5 .. :try_end_5} :catch_1

    :catch_1
    move-exception v5

    :try_start_6
    invoke-virtual/range {v20 .. v20}, Lorg/apache/http/client/methods/HttpGet;->abort()V
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_6 .. :try_end_6} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_6 .. :try_end_6} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_6 .. :try_end_6} :catch_3

    goto/16 :goto_0

    :catch_2
    move-exception v5

    move-object/from16 v6, v17

    move-object/from16 v7, v18

    :goto_3
    :try_start_7
    const-string v8, "DownloadManager"

    new-instance v9, Ljava/lang/StringBuilder;

    const-string v10, "FileNotFoundException for "

    invoke-direct {v9, v10}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v10, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, " : "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v8, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_6

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    const/4 v8, 0x0

    iput-boolean v8, v5, Lcom/ninesky/browser/provider/downloads/s;->B:Z

    if-eqz v6, :cond_4

    invoke-virtual {v6}, Landroid/os/PowerManager$WakeLock;->release()V

    :cond_4
    if-eqz v7, :cond_5

    invoke-virtual {v7}, Landroid/net/http/AndroidHttpClient;->close()V

    :cond_5
    const/16 v5, 0x1ec

    invoke-static {v15, v5}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;I)V

    const/16 v6, 0x1ec

    iget-boolean v7, v15, Lcom/ninesky/browser/provider/downloads/h;->d:Z

    iget v8, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    iget v9, v15, Lcom/ninesky/browser/provider/downloads/h;->f:I

    iget-boolean v10, v15, Lcom/ninesky/browser/provider/downloads/h;->i:Z

    iget-object v11, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    iget-object v12, v15, Lcom/ninesky/browser/provider/downloads/h;->g:Ljava/lang/String;

    iget-object v13, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    move-object/from16 v5, p0

    invoke-direct/range {v5 .. v13}, Lcom/ninesky/browser/provider/downloads/q;->a(IZIIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_2

    :cond_6
    :try_start_8
    new-instance v5, Ljava/io/File;

    iget-object v6, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-direct {v5, v6}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v5}, Ljava/io/File;->exists()Z

    move-result v6

    if-eqz v6, :cond_7

    invoke-virtual {v5}, Ljava/io/File;->length()J

    move-result-wide v6

    const-wide/16 v8, 0x0

    cmp-long v8, v6, v8

    if-nez v8, :cond_c

    invoke-virtual {v5}, Ljava/io/File;->delete()Z

    const/4 v5, 0x0

    iput-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    :cond_7
    :goto_4
    iget-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;

    if-eqz v5, :cond_8

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    iget v5, v5, Lcom/ninesky/browser/provider/downloads/s;->g:I

    if-nez v5, :cond_8

    invoke-static {v15}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;)Z

    move-result v5

    if-nez v5, :cond_8

    invoke-static {v15}, Lcom/ninesky/browser/provider/downloads/q;->b(Lcom/ninesky/browser/provider/downloads/h;)V

    :cond_8
    move-object/from16 v0, p0

    move-object/from16 v1, v21

    move-object/from16 v2, v20

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/m;Lorg/apache/http/client/methods/HttpGet;)V

    invoke-direct/range {p0 .. p0}, Lcom/ninesky/browser/provider/downloads/q;->a()V

    move-object/from16 v0, p0

    move-object v1, v15

    move-object/from16 v2, v18

    move-object/from16 v3, v20

    invoke-direct {v0, v1, v2, v3}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;Landroid/net/http/AndroidHttpClient;Lorg/apache/http/client/methods/HttpGet;)Lorg/apache/http/HttpResponse;

    move-result-object v23

    invoke-interface/range {v23 .. v23}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v5

    invoke-interface {v5}, Lorg/apache/http/StatusLine;->getStatusCode()I

    move-result v5

    const/16 v6, 0x1f7

    if-ne v5, v6, :cond_12

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v6, v0

    iget v6, v6, Lcom/ninesky/browser/provider/downloads/s;->k:I

    const/4 v7, 0x5

    if-ge v6, v7, :cond_12

    const/4 v5, 0x1

    iput-boolean v5, v15, Lcom/ninesky/browser/provider/downloads/h;->d:Z

    const-string v5, "Retry-After"

    move-object/from16 v0, v23

    move-object v1, v5

    invoke-interface {v0, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;
    :try_end_8
    .catchall {:try_start_8 .. :try_end_8} :catchall_0
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_8 .. :try_end_8} :catch_1

    move-result-object v5

    if-eqz v5, :cond_9

    :try_start_9
    invoke-interface {v5}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v5

    invoke-static {v5}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v5

    iput v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    iget v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    if-gez v5, :cond_f

    const/4 v5, 0x0

    iput v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I
    :try_end_9
    .catchall {:try_start_9 .. :try_end_9} :catchall_0
    .catch Ljava/lang/NumberFormatException; {:try_start_9 .. :try_end_9} :catch_4
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_9 .. :try_end_9} :catch_1

    :cond_9
    :goto_5
    :try_start_a
    new-instance v5, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v6, 0xc1

    move-object v0, v5

    move-object/from16 v1, p0

    move v2, v6

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v5
    :try_end_a
    .catchall {:try_start_a .. :try_end_a} :catchall_0
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_a .. :try_end_a} :catch_1

    :catchall_0
    move-exception v5

    :try_start_b
    invoke-virtual/range {v20 .. v20}, Lorg/apache/http/client/methods/HttpGet;->abort()V

    throw v5
    :try_end_b
    .catchall {:try_start_b .. :try_end_b} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_b .. :try_end_b} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_b .. :try_end_b} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_b .. :try_end_b} :catch_3

    :catch_3
    move-exception v5

    move-object/from16 v5, v17

    move-object/from16 v6, v18

    :goto_6
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v7, v0

    const/4 v8, 0x0

    iput-boolean v8, v7, Lcom/ninesky/browser/provider/downloads/s;->B:Z

    if-eqz v5, :cond_a

    invoke-virtual {v5}, Landroid/os/PowerManager$WakeLock;->release()V

    :cond_a
    if-eqz v6, :cond_b

    invoke-virtual {v6}, Landroid/net/http/AndroidHttpClient;->close()V

    :cond_b
    const/16 v5, 0x1eb

    invoke-static {v15, v5}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;I)V

    const/16 v6, 0x1eb

    iget-boolean v7, v15, Lcom/ninesky/browser/provider/downloads/h;->d:Z

    iget v8, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    iget v9, v15, Lcom/ninesky/browser/provider/downloads/h;->f:I

    iget-boolean v10, v15, Lcom/ninesky/browser/provider/downloads/h;->i:Z

    iget-object v11, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    iget-object v12, v15, Lcom/ninesky/browser/provider/downloads/h;->g:Ljava/lang/String;

    iget-object v13, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    move-object/from16 v5, p0

    invoke-direct/range {v5 .. v13}, Lcom/ninesky/browser/provider/downloads/q;->a(IZIIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_2

    :cond_c
    :try_start_c
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v8, v0

    iget-object v8, v8, Lcom/ninesky/browser/provider/downloads/s;->v:Ljava/lang/String;

    if-nez v8, :cond_d

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v8, v0

    iget-boolean v8, v8, Lcom/ninesky/browser/provider/downloads/s;->c:Z

    if-nez v8, :cond_d

    invoke-virtual {v5}, Ljava/io/File;->delete()Z

    new-instance v5, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v6, 0x1e9

    move-object v0, v5

    move-object/from16 v1, p0

    move v2, v6

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v5

    :cond_d
    new-instance v5, Ljava/io/FileOutputStream;

    iget-object v8, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    const/4 v9, 0x1

    invoke-direct {v5, v8, v9}, Ljava/io/FileOutputStream;-><init>(Ljava/lang/String;Z)V

    iput-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;

    long-to-int v5, v6

    move v0, v5

    move-object/from16 v1, v21

    iput v0, v1, Lcom/ninesky/browser/provider/downloads/m;->a:I

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    iget-wide v5, v5, Lcom/ninesky/browser/provider/downloads/s;->t:J

    const-wide/16 v7, -0x1

    cmp-long v5, v5, v7

    if-eqz v5, :cond_e

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    iget-wide v5, v5, Lcom/ninesky/browser/provider/downloads/s;->t:J

    invoke-static {v5, v6}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v5

    move-object v0, v5

    move-object/from16 v1, v21

    iput-object v0, v1, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    :cond_e
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    iget-object v5, v5, Lcom/ninesky/browser/provider/downloads/s;->v:Ljava/lang/String;

    move-object v0, v5

    move-object/from16 v1, v21

    iput-object v0, v1, Lcom/ninesky/browser/provider/downloads/m;->b:Ljava/lang/String;

    const/4 v5, 0x1

    move v0, v5

    move-object/from16 v1, v21

    iput-boolean v0, v1, Lcom/ninesky/browser/provider/downloads/m;->c:Z
    :try_end_c
    .catchall {:try_start_c .. :try_end_c} :catchall_0
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_c .. :try_end_c} :catch_1

    goto/16 :goto_4

    :cond_f
    :try_start_d
    iget v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    const/16 v6, 0x1e

    if-ge v5, v6, :cond_11

    const/16 v5, 0x1e

    iput v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    :cond_10
    :goto_7
    iget v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    sget-object v6, Lcom/ninesky/browser/provider/downloads/g;->a:Ljava/util/Random;

    const/16 v7, 0x1f

    invoke-virtual {v6, v7}, Ljava/util/Random;->nextInt(I)I

    move-result v6

    add-int/2addr v5, v6

    iput v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    iget v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    mul-int/lit16 v5, v5, 0x3e8

    iput v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    goto/16 :goto_5

    :catch_4
    move-exception v5

    goto/16 :goto_5

    :cond_11
    iget v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    const v6, 0x15180

    if-le v5, v6, :cond_10

    const v5, 0x15180

    iput v5, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I
    :try_end_d
    .catchall {:try_start_d .. :try_end_d} :catchall_0
    .catch Ljava/lang/NumberFormatException; {:try_start_d .. :try_end_d} :catch_4
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_d .. :try_end_d} :catch_1

    goto :goto_7

    :cond_12
    const/16 v6, 0x12d

    if-eq v5, v6, :cond_13

    const/16 v6, 0x12e

    if-eq v5, v6, :cond_13

    const/16 v6, 0x12f

    if-eq v5, v6, :cond_13

    const/16 v6, 0x133

    if-ne v5, v6, :cond_17

    :cond_13
    :try_start_e
    iget v6, v15, Lcom/ninesky/browser/provider/downloads/h;->f:I

    const/4 v7, 0x5

    if-lt v6, v7, :cond_14

    new-instance v5, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v6, 0x1f1

    move-object v0, v5

    move-object/from16 v1, p0

    move v2, v6

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v5

    :cond_14
    const-string v6, "Location"

    move-object/from16 v0, v23

    move-object v1, v6

    invoke-interface {v0, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;
    :try_end_e
    .catchall {:try_start_e .. :try_end_e} :catchall_0
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_e .. :try_end_e} :catch_1

    move-result-object v6

    if-eqz v6, :cond_17

    :try_start_f
    new-instance v7, Ljava/net/URI;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v8, v0

    iget-object v8, v8, Lcom/ninesky/browser/provider/downloads/s;->b:Ljava/lang/String;

    invoke-direct {v7, v8}, Ljava/net/URI;-><init>(Ljava/lang/String;)V

    new-instance v8, Ljava/net/URI;

    invoke-interface {v6}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v6

    invoke-direct {v8, v6}, Ljava/net/URI;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7, v8}, Ljava/net/URI;->resolve(Ljava/net/URI;)Ljava/net/URI;

    move-result-object v6

    invoke-virtual {v6}, Ljava/net/URI;->toString()Ljava/lang/String;
    :try_end_f
    .catchall {:try_start_f .. :try_end_f} :catchall_0
    .catch Ljava/net/URISyntaxException; {:try_start_f .. :try_end_f} :catch_5
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_f .. :try_end_f} :catch_1

    move-result-object v6

    :try_start_10
    iget v7, v15, Lcom/ninesky/browser/provider/downloads/h;->f:I

    add-int/lit8 v7, v7, 0x1

    iput v7, v15, Lcom/ninesky/browser/provider/downloads/h;->f:I

    iput-object v6, v15, Lcom/ninesky/browser/provider/downloads/h;->j:Ljava/lang/String;

    const/16 v7, 0x12d

    if-eq v5, v7, :cond_15

    const/16 v7, 0x12f

    if-ne v5, v7, :cond_16

    :cond_15
    iput-object v6, v15, Lcom/ninesky/browser/provider/downloads/h;->g:Ljava/lang/String;

    :cond_16
    new-instance v5, Lcom/ninesky/browser/provider/downloads/u;

    move-object v0, v5

    move-object/from16 v1, p0

    invoke-direct {v0, v1}, Lcom/ninesky/browser/provider/downloads/u;-><init>(Lcom/ninesky/browser/provider/downloads/q;)V

    throw v5

    :catch_5
    move-exception v5

    new-instance v5, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v6, 0x1ef

    move-object v0, v5

    move-object/from16 v1, p0

    move v2, v6

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v5

    :cond_17
    move-object/from16 v0, v21

    iget-boolean v0, v0, Lcom/ninesky/browser/provider/downloads/m;->c:Z

    move v6, v0

    if-eqz v6, :cond_18

    const/16 v6, 0xce

    :goto_8
    if-eq v5, v6, :cond_1c

    invoke-static {v5}, Lcom/ninesky/browser/provider/downloads/w;->b(I)Z

    move-result v6

    if-eqz v6, :cond_19

    :goto_9
    new-instance v6, Lcom/ninesky/browser/provider/downloads/k;

    move-object v0, v6

    move-object/from16 v1, p0

    move v2, v5

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v6

    :cond_18
    const/16 v6, 0xc8

    goto :goto_8

    :cond_19
    const/16 v6, 0x12c

    if-lt v5, v6, :cond_1a

    const/16 v6, 0x190

    if-ge v5, v6, :cond_1a

    const/16 v5, 0x1ed

    goto :goto_9

    :cond_1a
    move-object/from16 v0, v21

    iget-boolean v0, v0, Lcom/ninesky/browser/provider/downloads/m;->c:Z

    move v6, v0

    if-eqz v6, :cond_1b

    const/16 v6, 0xc8

    if-ne v5, v6, :cond_1b

    const/16 v5, 0x1e9

    goto :goto_9

    :cond_1b
    const/16 v5, 0x1ee

    goto :goto_9

    :cond_1c
    move-object/from16 v0, v21

    iget-boolean v0, v0, Lcom/ninesky/browser/provider/downloads/m;->c:Z

    move v5, v0

    if-nez v5, :cond_2a

    const-string v5, "Content-Disposition"

    move-object/from16 v0, v23

    move-object v1, v5

    invoke-interface {v0, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v5

    if-eqz v5, :cond_1d

    invoke-interface {v5}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v5

    move-object v0, v5

    move-object/from16 v1, v21

    iput-object v0, v1, Lcom/ninesky/browser/provider/downloads/m;->e:Ljava/lang/String;

    :cond_1d
    const-string v5, "Content-Location"

    move-object/from16 v0, v23

    move-object v1, v5

    invoke-interface {v0, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v5

    if-eqz v5, :cond_1e

    invoke-interface {v5}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v5

    move-object v0, v5

    move-object/from16 v1, v21

    iput-object v0, v1, Lcom/ninesky/browser/provider/downloads/m;->f:Ljava/lang/String;

    :cond_1e
    iget-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    if-nez v5, :cond_1f

    const-string v5, "Content-Type"

    move-object/from16 v0, v23

    move-object v1, v5

    invoke-interface {v0, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v5

    if-eqz v5, :cond_1f

    invoke-interface {v5}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v5

    invoke-static {v5}, Lcom/ninesky/browser/provider/downloads/q;->b(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    iput-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    :cond_1f
    const-string v5, "ETag"

    move-object/from16 v0, v23

    move-object v1, v5

    invoke-interface {v0, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v5

    if-eqz v5, :cond_20

    invoke-interface {v5}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v5

    move-object v0, v5

    move-object/from16 v1, v21

    iput-object v0, v1, Lcom/ninesky/browser/provider/downloads/m;->b:Ljava/lang/String;

    :cond_20
    const/4 v5, 0x0

    const-string v6, "Transfer-Encoding"

    move-object/from16 v0, v23

    move-object v1, v6

    invoke-interface {v0, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v6

    if-eqz v6, :cond_21

    invoke-interface {v6}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v5

    :cond_21
    if-nez v5, :cond_22

    const-string v6, "Content-Length"

    move-object/from16 v0, v23

    move-object v1, v6

    invoke-interface {v0, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v6

    if-eqz v6, :cond_22

    invoke-interface {v6}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v6

    move-object v0, v6

    move-object/from16 v1, v21

    iput-object v0, v1, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v6, v0

    move-object/from16 v0, v21

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    move-object v7, v0

    invoke-static {v7}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J

    move-result-wide v7

    iput-wide v7, v6, Lcom/ninesky/browser/provider/downloads/s;->t:J

    :cond_22
    move-object/from16 v0, v21

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    move-object v6, v0

    if-nez v6, :cond_24

    if-eqz v5, :cond_23

    const-string v6, "chunked"

    invoke-virtual {v5, v6}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v5

    if-nez v5, :cond_24

    :cond_23
    const/4 v5, 0x1

    :goto_a
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v6, v0

    iget-boolean v6, v6, Lcom/ninesky/browser/provider/downloads/s;->c:Z

    if-nez v6, :cond_25

    if-eqz v5, :cond_25

    const-string v5, "DownloadManager"

    const-string v6, "can\'t know size of download, giving up"

    invoke-static {v5, v6}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    new-instance v5, Lcom/ninesky/browser/provider/downloads/k;

    const/16 v6, 0x1ef

    move-object v0, v5

    move-object/from16 v1, p0

    move v2, v6

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v5

    :cond_24
    const/4 v5, 0x0

    goto :goto_a

    :cond_25
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    move-object v5, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v6, v0

    iget-object v6, v6, Lcom/ninesky/browser/provider/downloads/s;->b:Ljava/lang/String;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v7, v0

    iget-object v7, v7, Lcom/ninesky/browser/provider/downloads/s;->d:Ljava/lang/String;

    move-object/from16 v0, v21

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/m;->e:Ljava/lang/String;

    move-object v8, v0

    move-object/from16 v0, v21

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/m;->f:Ljava/lang/String;

    move-object v9, v0

    iget-object v10, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v11, v0

    iget v11, v11, Lcom/ninesky/browser/provider/downloads/s;->g:I

    move-object/from16 v0, v21

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    move-object v12, v0

    if-eqz v12, :cond_26

    move-object/from16 v0, v21

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/m;->d:Ljava/lang/String;

    move-object v12, v0

    invoke-static {v12}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J

    move-result-wide v12

    :goto_b
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v14, v0

    iget-boolean v14, v14, Lcom/ninesky/browser/provider/downloads/s;->x:Z

    invoke-static/range {v5 .. v14}, Lcom/ninesky/browser/provider/downloads/g;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IJZ)Lcom/ninesky/browser/provider/downloads/v;

    move-result-object v5

    iget-object v6, v5, Lcom/ninesky/browser/provider/downloads/v;->a:Ljava/lang/String;

    if-nez v6, :cond_27

    new-instance v6, Lcom/ninesky/browser/provider/downloads/k;

    iget v5, v5, Lcom/ninesky/browser/provider/downloads/v;->c:I

    move-object v0, v6

    move-object/from16 v1, p0

    move v2, v5

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/k;-><init>(Lcom/ninesky/browser/provider/downloads/q;I)V

    throw v6

    :cond_26
    const-wide/16 v12, 0x0

    goto :goto_b

    :cond_27
    iget-object v6, v5, Lcom/ninesky/browser/provider/downloads/v;->a:Ljava/lang/String;

    iput-object v6, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    iget-object v5, v5, Lcom/ninesky/browser/provider/downloads/v;->b:Ljava/io/FileOutputStream;

    iput-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->b:Ljava/io/FileOutputStream;

    new-instance v5, Landroid/content/ContentValues;

    invoke-direct {v5}, Landroid/content/ContentValues;-><init>()V

    const-string v6, "_data"

    iget-object v7, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-virtual {v5, v6, v7}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    move-object/from16 v0, v21

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/m;->b:Ljava/lang/String;

    move-object v6, v0

    if-eqz v6, :cond_28

    const-string v6, "etag"

    move-object/from16 v0, v21

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/m;->b:Ljava/lang/String;

    move-object v7, v0

    invoke-virtual {v5, v6, v7}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    :cond_28
    iget-object v6, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    if-eqz v6, :cond_29

    const-string v6, "mimetype"

    iget-object v7, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    invoke-virtual {v5, v6, v7}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    :cond_29
    const-string v6, "total_bytes"

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v7, v0

    iget-wide v7, v7, Lcom/ninesky/browser/provider/downloads/s;->t:J

    invoke-static {v7, v8}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v7

    invoke-virtual {v5, v6, v7}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->a:Landroid/content/Context;

    move-object v6, v0

    invoke-virtual {v6}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v6

    iget-object v7, v15, Lcom/ninesky/browser/provider/downloads/h;->h:Landroid/net/Uri;

    const/4 v8, 0x0

    const/4 v9, 0x0

    invoke-virtual {v6, v7, v5, v8, v9}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    invoke-direct/range {p0 .. p0}, Lcom/ninesky/browser/provider/downloads/q;->a()V

    :cond_2a
    move-object/from16 v0, p0

    move-object v1, v15

    move-object/from16 v2, v23

    invoke-direct {v0, v1, v2}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;Lorg/apache/http/HttpResponse;)Ljava/io/InputStream;

    move-result-object v5

    move-object/from16 v0, p0

    move-object v1, v15

    move-object/from16 v2, v21

    move-object/from16 v3, v22

    move-object v4, v5

    invoke-direct {v0, v1, v2, v3, v4}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;Lcom/ninesky/browser/provider/downloads/m;[BLjava/io/InputStream;)V
    :try_end_10
    .catchall {:try_start_10 .. :try_end_10} :catchall_0
    .catch Lcom/ninesky/browser/provider/downloads/u; {:try_start_10 .. :try_end_10} :catch_1

    const/4 v5, 0x1

    :try_start_11
    invoke-virtual/range {v20 .. v20}, Lorg/apache/http/client/methods/HttpGet;->abort()V

    move/from16 v19, v5

    goto/16 :goto_0

    :cond_2b
    invoke-virtual {v6}, Landroid/content/Intent;->getDataString()Ljava/lang/String;

    move-result-object v5

    iput-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-virtual {v6}, Landroid/content/Intent;->getType()Ljava/lang/String;

    move-result-object v5

    iput-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;
    :try_end_11
    .catchall {:try_start_11 .. :try_end_11} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_11 .. :try_end_11} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_11 .. :try_end_11} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_11 .. :try_end_11} :catch_3

    :cond_2c
    :goto_c
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v5, v0

    const/4 v6, 0x0

    iput-boolean v6, v5, Lcom/ninesky/browser/provider/downloads/s;->B:Z

    if-eqz v17, :cond_2d

    invoke-virtual/range {v17 .. v17}, Landroid/os/PowerManager$WakeLock;->release()V

    :cond_2d
    if-eqz v18, :cond_2e

    invoke-virtual/range {v18 .. v18}, Landroid/net/http/AndroidHttpClient;->close()V

    :cond_2e
    const/16 v5, 0xc8

    invoke-static {v15, v5}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;I)V

    const/16 v6, 0xc8

    iget-boolean v7, v15, Lcom/ninesky/browser/provider/downloads/h;->d:Z

    iget v8, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    iget v9, v15, Lcom/ninesky/browser/provider/downloads/h;->f:I

    iget-boolean v10, v15, Lcom/ninesky/browser/provider/downloads/h;->i:Z

    iget-object v11, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    iget-object v12, v15, Lcom/ninesky/browser/provider/downloads/h;->g:Ljava/lang/String;

    iget-object v13, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    move-object/from16 v5, p0

    invoke-direct/range {v5 .. v13}, Lcom/ninesky/browser/provider/downloads/q;->a(IZIIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_2

    :cond_2f
    :try_start_12
    iget-object v5, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    const/16 v6, 0x1a4

    const/4 v7, -0x1

    const/4 v8, -0x1

    invoke-static {v5, v6, v7, v8}, Landroid/os/FileUtils;->setPermissions(Ljava/lang/String;III)I
    :try_end_12
    .catchall {:try_start_12 .. :try_end_12} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_12 .. :try_end_12} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_12 .. :try_end_12} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_12 .. :try_end_12} :catch_3

    const/4 v5, 0x0

    :try_start_13
    new-instance v6, Ljava/io/FileOutputStream;

    iget-object v7, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    const/4 v8, 0x1

    invoke-direct {v6, v7, v8}, Ljava/io/FileOutputStream;-><init>(Ljava/lang/String;Z)V
    :try_end_13
    .catchall {:try_start_13 .. :try_end_13} :catchall_2
    .catch Ljava/io/FileNotFoundException; {:try_start_13 .. :try_end_13} :catch_7
    .catch Ljava/io/SyncFailedException; {:try_start_13 .. :try_end_13} :catch_a
    .catch Ljava/io/IOException; {:try_start_13 .. :try_end_13} :catch_d
    .catch Ljava/lang/RuntimeException; {:try_start_13 .. :try_end_13} :catch_10

    :try_start_14
    invoke-virtual {v6}, Ljava/io/FileOutputStream;->getFD()Ljava/io/FileDescriptor;

    move-result-object v5

    invoke-virtual {v5}, Ljava/io/FileDescriptor;->sync()V
    :try_end_14
    .catchall {:try_start_14 .. :try_end_14} :catchall_7
    .catch Ljava/io/FileNotFoundException; {:try_start_14 .. :try_end_14} :catch_1f
    .catch Ljava/io/SyncFailedException; {:try_start_14 .. :try_end_14} :catch_1e
    .catch Ljava/io/IOException; {:try_start_14 .. :try_end_14} :catch_1d
    .catch Ljava/lang/RuntimeException; {:try_start_14 .. :try_end_14} :catch_1c

    :try_start_15
    invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
    :try_end_15
    .catchall {:try_start_15 .. :try_end_15} :catchall_1
    .catch Ljava/io/IOException; {:try_start_15 .. :try_end_15} :catch_6
    .catch Ljava/lang/RuntimeException; {:try_start_15 .. :try_end_15} :catch_15
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_15 .. :try_end_15} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_15 .. :try_end_15} :catch_2

    goto :goto_c

    :catch_6
    move-exception v5

    :try_start_16
    const-string v6, "DownloadManager"

    const-string v7, "IOException while closing synced file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_16
    .catchall {:try_start_16 .. :try_end_16} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_16 .. :try_end_16} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_16 .. :try_end_16} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_16 .. :try_end_16} :catch_3

    goto :goto_c

    :catchall_1
    move-exception v5

    move-object v14, v5

    move-object/from16 v6, v18

    move-object/from16 v5, v17

    :goto_d
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/ninesky/browser/provider/downloads/q;->b:Lcom/ninesky/browser/provider/downloads/s;

    move-object v7, v0

    const/4 v8, 0x0

    iput-boolean v8, v7, Lcom/ninesky/browser/provider/downloads/s;->B:Z

    if-eqz v5, :cond_30

    invoke-virtual {v5}, Landroid/os/PowerManager$WakeLock;->release()V

    :cond_30
    if-eqz v6, :cond_31

    invoke-virtual {v6}, Landroid/net/http/AndroidHttpClient;->close()V

    :cond_31
    invoke-static/range {v15 .. v16}, Lcom/ninesky/browser/provider/downloads/q;->a(Lcom/ninesky/browser/provider/downloads/h;I)V

    iget-boolean v7, v15, Lcom/ninesky/browser/provider/downloads/h;->d:Z

    iget v8, v15, Lcom/ninesky/browser/provider/downloads/h;->e:I

    iget v9, v15, Lcom/ninesky/browser/provider/downloads/h;->f:I

    iget-boolean v10, v15, Lcom/ninesky/browser/provider/downloads/h;->i:Z

    iget-object v11, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    iget-object v12, v15, Lcom/ninesky/browser/provider/downloads/h;->g:Ljava/lang/String;

    iget-object v13, v15, Lcom/ninesky/browser/provider/downloads/h;->c:Ljava/lang/String;

    move-object/from16 v5, p0

    move/from16 v6, v16

    invoke-direct/range {v5 .. v13}, Lcom/ninesky/browser/provider/downloads/q;->a(IZIIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    throw v14

    :catch_7
    move-exception v6

    move-object/from16 v24, v6

    move-object v6, v5

    move-object/from16 v5, v24

    :goto_e
    :try_start_17
    const-string v7, "DownloadManager"

    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, "file "

    invoke-direct {v8, v9}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v9, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, " not found: "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_17
    .catchall {:try_start_17 .. :try_end_17} :catchall_7

    if-eqz v6, :cond_2c

    :try_start_18
    invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
    :try_end_18
    .catchall {:try_start_18 .. :try_end_18} :catchall_1
    .catch Ljava/io/IOException; {:try_start_18 .. :try_end_18} :catch_8
    .catch Ljava/lang/RuntimeException; {:try_start_18 .. :try_end_18} :catch_9
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_18 .. :try_end_18} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_18 .. :try_end_18} :catch_2

    goto/16 :goto_c

    :catch_8
    move-exception v5

    :try_start_19
    const-string v6, "DownloadManager"

    const-string v7, "IOException while closing synced file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_c

    :catch_9
    move-exception v5

    const-string v6, "DownloadManager"

    const-string v7, "exception while closing file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_19
    .catchall {:try_start_19 .. :try_end_19} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_19 .. :try_end_19} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_19 .. :try_end_19} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_19 .. :try_end_19} :catch_3

    goto/16 :goto_c

    :catch_a
    move-exception v6

    move-object/from16 v24, v6

    move-object v6, v5

    move-object/from16 v5, v24

    :goto_f
    :try_start_1a
    const-string v7, "DownloadManager"

    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, "file "

    invoke-direct {v8, v9}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v9, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, " sync failed: "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_1a
    .catchall {:try_start_1a .. :try_end_1a} :catchall_7

    if-eqz v6, :cond_2c

    :try_start_1b
    invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
    :try_end_1b
    .catchall {:try_start_1b .. :try_end_1b} :catchall_1
    .catch Ljava/io/IOException; {:try_start_1b .. :try_end_1b} :catch_b
    .catch Ljava/lang/RuntimeException; {:try_start_1b .. :try_end_1b} :catch_c
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_1b .. :try_end_1b} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_1b .. :try_end_1b} :catch_2

    goto/16 :goto_c

    :catch_b
    move-exception v5

    :try_start_1c
    const-string v6, "DownloadManager"

    const-string v7, "IOException while closing synced file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_c

    :catch_c
    move-exception v5

    const-string v6, "DownloadManager"

    const-string v7, "exception while closing file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_1c
    .catchall {:try_start_1c .. :try_end_1c} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_1c .. :try_end_1c} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_1c .. :try_end_1c} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_1c .. :try_end_1c} :catch_3

    goto/16 :goto_c

    :catch_d
    move-exception v6

    move-object/from16 v24, v6

    move-object v6, v5

    move-object/from16 v5, v24

    :goto_10
    :try_start_1d
    const-string v7, "DownloadManager"

    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, "IOException trying to sync "

    invoke-direct {v8, v9}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v9, v15, Lcom/ninesky/browser/provider/downloads/h;->a:Ljava/lang/String;

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, ": "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_1d
    .catchall {:try_start_1d .. :try_end_1d} :catchall_7

    if-eqz v6, :cond_2c

    :try_start_1e
    invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
    :try_end_1e
    .catchall {:try_start_1e .. :try_end_1e} :catchall_1
    .catch Ljava/io/IOException; {:try_start_1e .. :try_end_1e} :catch_e
    .catch Ljava/lang/RuntimeException; {:try_start_1e .. :try_end_1e} :catch_f
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_1e .. :try_end_1e} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_1e .. :try_end_1e} :catch_2

    goto/16 :goto_c

    :catch_e
    move-exception v5

    :try_start_1f
    const-string v6, "DownloadManager"

    const-string v7, "IOException while closing synced file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_c

    :catch_f
    move-exception v5

    const-string v6, "DownloadManager"

    const-string v7, "exception while closing file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_1f
    .catchall {:try_start_1f .. :try_end_1f} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_1f .. :try_end_1f} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_1f .. :try_end_1f} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_1f .. :try_end_1f} :catch_3

    goto/16 :goto_c

    :catch_10
    move-exception v6

    move-object/from16 v24, v6

    move-object v6, v5

    move-object/from16 v5, v24

    :goto_11
    :try_start_20
    const-string v7, "DownloadManager"

    const-string v8, "exception while syncing file: "

    invoke-static {v7, v8, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_20
    .catchall {:try_start_20 .. :try_end_20} :catchall_7

    if-eqz v6, :cond_2c

    :try_start_21
    invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
    :try_end_21
    .catchall {:try_start_21 .. :try_end_21} :catchall_1
    .catch Ljava/io/IOException; {:try_start_21 .. :try_end_21} :catch_11
    .catch Ljava/lang/RuntimeException; {:try_start_21 .. :try_end_21} :catch_12
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_21 .. :try_end_21} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_21 .. :try_end_21} :catch_2

    goto/16 :goto_c

    :catch_11
    move-exception v5

    :try_start_22
    const-string v6, "DownloadManager"

    const-string v7, "IOException while closing synced file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_c

    :catch_12
    move-exception v5

    const-string v6, "DownloadManager"

    const-string v7, "exception while closing file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_22
    .catchall {:try_start_22 .. :try_end_22} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_22 .. :try_end_22} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_22 .. :try_end_22} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_22 .. :try_end_22} :catch_3

    goto/16 :goto_c

    :catchall_2
    move-exception v6

    move-object/from16 v24, v6

    move-object v6, v5

    move-object/from16 v5, v24

    :goto_12
    if-eqz v6, :cond_32

    :try_start_23
    invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
    :try_end_23
    .catchall {:try_start_23 .. :try_end_23} :catchall_1
    .catch Ljava/io/IOException; {:try_start_23 .. :try_end_23} :catch_13
    .catch Ljava/lang/RuntimeException; {:try_start_23 .. :try_end_23} :catch_14
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_23 .. :try_end_23} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_23 .. :try_end_23} :catch_2

    :cond_32
    :goto_13
    :try_start_24
    throw v5

    :catch_13
    move-exception v6

    const-string v7, "DownloadManager"

    const-string v8, "IOException while closing synced file: "

    invoke-static {v7, v8, v6}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_13

    :catch_14
    move-exception v6

    const-string v7, "DownloadManager"

    const-string v8, "exception while closing file: "

    invoke-static {v7, v8, v6}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_13

    :catch_15
    move-exception v5

    const-string v6, "DownloadManager"

    const-string v7, "exception while closing file: "

    invoke-static {v6, v7, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_24
    .catchall {:try_start_24 .. :try_end_24} :catchall_1
    .catch Lcom/ninesky/browser/provider/downloads/k; {:try_start_24 .. :try_end_24} :catch_0
    .catch Ljava/io/FileNotFoundException; {:try_start_24 .. :try_end_24} :catch_2
    .catch Ljava/lang/RuntimeException; {:try_start_24 .. :try_end_24} :catch_3

    goto/16 :goto_c

    :catchall_3
    move-exception v5

    move-object v14, v5

    move-object v5, v7

    goto/16 :goto_d

    :catchall_4
    move-exception v5

    move-object v14, v5

    move-object/from16 v5, v17

    goto/16 :goto_d

    :catchall_5
    move-exception v5

    move-object v14, v5

    move-object v6, v8

    move-object v5, v7

    goto/16 :goto_d

    :catchall_6
    move-exception v5

    move-object v14, v5

    move-object v5, v6

    move-object v6, v7

    goto/16 :goto_d

    :catch_16
    move-exception v5

    move-object v5, v7

    goto/16 :goto_6

    :catch_17
    move-exception v5

    move-object/from16 v5, v17

    goto/16 :goto_6

    :catch_18
    move-exception v5

    move-object/from16 v24, v7

    move-object v7, v6

    move-object/from16 v6, v24

    goto/16 :goto_3

    :catch_19
    move-exception v5

    move-object v7, v6

    move-object/from16 v6, v17

    goto/16 :goto_3

    :catch_1a
    move-exception v5

    move-object v8, v6

    goto/16 :goto_1

    :catch_1b
    move-exception v5

    move-object/from16 v7, v17

    move-object v8, v6

    goto/16 :goto_1

    :catchall_7
    move-exception v5

    goto :goto_12

    :catch_1c
    move-exception v5

    goto/16 :goto_11

    :catch_1d
    move-exception v5

    goto/16 :goto_10

    :catch_1e
    move-exception v5

    goto/16 :goto_f

    :catch_1f
    move-exception v5

    goto/16 :goto_e
.end method
